package com.cz.util;

import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;

/**
 * Created by Administrator on 2014/12/23.
 */
public class DbUtil {
    public static SqlSessionFactory getSessionFactory() {
        SqlSessionFactory sessionFactory = null;
        String resource = "conf/configuration.xml";
        File f = new File(resource);

        try {
            BufferedReader input = new BufferedReader(new FileReader(f));
            sessionFactory = new SqlSessionFactoryBuilder().build(input);
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        return sessionFactory;
    }
}